package com.lucy.starter.exception;

import com.lucy.starter.constant.HttpStatus;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author kindear
 * 自定义异常类
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class BusinessException extends RuntimeException{
    Integer code;

    public BusinessException(){}
    public BusinessException(String message){
        super(message);
    }
    public BusinessException(String message, Throwable cause){
        super(message, cause);
    }
    public BusinessException(Throwable cause){
        super(cause);
    }
    public BusinessException(HttpStatus status){
        super(status.getReasonPhrase());
        this.code = status.value();
    }
    public BusinessException(HttpStatus status, String msg){
        super(msg);
        this.code = status.value();
    }
    public BusinessException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }

}
